#ifndef _IOFILE_H_
#define _IOFILE_H_

#include "ioeventdef.h"

uvNameSpaceBegin

struct io_file_t {
	io_data	io;
	struct bufferevent *bev;
	io_event_loop*		eventloop;
	struct event* ev;
	int iwritealive;
	int ireadlive;
	void(*file_fun_writecb)(io_file_t *pData, unsigned long ulen);
	void(*file_fun_readcb)(io_file_t *pData, unsigned long ulen);
	void(*file_fun_writefailcb)(io_file_t *pData);
	void(*file_fun_readfailcb)(io_file_t *pData);
};


int	io_file_init(io_file_t* pFile);
int	io_file_write(io_file_t* pFile, unsigned char* buf, unsigned long ulen);
int	io_file_read(io_file_t* pFile);
int	io_file_close(io_file_t* pFile);

uvNameSpaceEnd

#endif 